Skip to content

F-002: refactor(app): make hook and clipboard methods non-blocking (re-do)#34

Merged
Sephyi merged 1 commit intodevelopmentfrom
audit/f-002-redo
Apr 30, 2026
Merged

F-002: refactor(app): make hook and clipboard methods non-blocking (re-do)#34
Sephyi merged 1 commit intodevelopmentfrom
audit/f-002-redo

Conversation

@Sephyi
Copy link
Copy Markdown
Owner

@Sephyi Sephyi commented Apr 30, 2026

Re-implementation of closed #11 on top of current development. Replaces the #[allow(clippy::disallowed_methods)] shim added in #21 with a real async migration:

  • Hook path uses tokio::process::Command for git rev-parse --git-dir (with the std::process::Output type annotation per CLAUDE.md gotcha). hook_dir/hook_path/hook_install/hook_uninstall/hook_status/handle_hook are now async fn.
  • Clipboard path uses tokio::task::spawn_blocking (arboard is sync, not a subprocess).
  • The F-018 sequencing shim is removed.

Closes #11.

Test plan

  • cargo fmt --check
  • cargo clippy --all-targets -- -D warnings
  • cargo test --all-targets --all-features (437 tests pass)

Replaces the F-018 sequencing shim at `src/app.rs:1030` with a real
async migration of the two paths the audit flagged for blocking the
Tokio runtime.

Hook path:
- `hook_dir` → `async fn`, uses `tokio::process::Command` for
  `git rev-parse --git-dir` (with the explicit `std::process::Output`
  type annotation per CLAUDE.md gotcha).
- `hook_path`, `hook_install`, `hook_uninstall`, `hook_status`,
  and `handle_hook` are all `async fn` and `.await` the chain.
- `Commands::Hook { action }` dispatch in `handle_command` now
  `.await`s `handle_hook`.

Clipboard path:
- `arboard` is a synchronous library (not a subprocess), so the
  correct fix is `tokio::task::spawn_blocking` rather than
  `tokio::process::Command`.
- `copy_to_clipboard` now takes `String` (owned, since it crosses the
  blocking-task boundary) and returns the result via `await`.
- The `--clipboard` flow in `generate_commit` calls `await` on the
  helper.

The `#[allow(clippy::disallowed_methods)]` shim added in #21 (F-018)
is removed — the lint now has nothing to suppress in this file.

Closes #11.
Copilot AI review requested due to automatic review settings April 30, 2026 17:01
@Sephyi Sephyi merged commit a596642 into development Apr 30, 2026
1 of 2 checks passed
@Sephyi Sephyi deleted the audit/f-002-redo branch April 30, 2026 17:01
@github-actions github-actions Bot locked and limited conversation to collaborators Apr 30, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant